const log = require('../server/libs/SysLog/OutPut');

async function koa(ctx, next) {
    if (ctx.request._logging) {
        await next();
        return;
    }
    let start = new Date();
    await next();

    let code = ctx.res.statusCode;
    let str = `${ctx.method} ${code} ${new Date() - start}ms ${ctx.originalUrl}`;
    log.info(str);
}
module.exports = koa;